#ifndef _WIFIAPI_H_
#define _WIFIAPI_H_

#include "syscore.h"
#include "apis.h"
#include "./../gsm/network_frame.h"

#ifdef __cplusplus
extern "C" {
#endif

#define WIFI_MODULE_IP           "192.168.178.111"
#define WIFI_MODULE_PORT         "8899"
#define WIFI_XIAN_BOARD_IP       "192.168.178.206"

#define WIFI_OUR_BOARD_PORT      "2501"
#define WIFI_OUR_BOARD_IP        "127.0.0.1"


//internal marco
#define TICK_INTERVAL                  1000
#define TICK_SECOND                    (TICK_INTERVAL / 1000)    

#define INVALID_CMD_CODE               0xffff
#define INVALID_SRC_ID                 0xffff

#define MAC_ID_LENGTH                  17 
#define MAC_ID_NOCOLON                 12   

#define WIFI_MSG_SSID                  "*SSID: "
#define WIFI_SSID_LENGTH               7
#define WIFI_MSG_BSSID                 "*BSSID: "
#define WIFI_BSSID_LENGTH              8
#define WIFI_MSG_CLIENT                "*CLIENT: "
#define WIFI_CLIENT_LENGTH             9
#define WIFI_MAC_MSG_LENGTH            25

typedef enum {
    WIFI_MODULE_IDLE,
	WIFI_MODULE_CONFIGING,
    WIFI_MODULE_CONFIGED,
    WIFI_MODULE_RESTART,
    WIFI_MODULE_RUNNING,
    WIFI_MODULE_SHUTDOWN,
    WIFI_MODULE_NSYNC    
} wifiModuleState_t;

typedef struct
{
    U32   paramType;
    U32   paramLength;
}wifiParamCode_t;

typedef struct
{
     U16           srcID;
     CMDHEADER     cmdHdr;
}tlvCmdRecord_t;

typedef int (*PROTOCOL_HANDLER)(const char* ,ssize_t, conn_t *);

typedef struct /*_PROTOCOL_HANDLER*/ 
{	
    const char* enable;	
	const char* header;	
	PROTOCOL_HANDLER handler;
} HANDLER;

#ifdef __cplusplus
}
#endif

#endif

